com.cete.dynamicpdf
Class DocumentReaderEvents



Example : The following example shows how to use document reader events.
   import com.cete.dynamicpdf.*;
   import com.cete.dynamicpdf.pageelements.*;
   import com.cete.dynamicpdf.pageelements.forms.*;
   
    public class MyClass {
        public static void main(String args[]) {
		
        // Create a PDF Document
	Document document = new Document();

	// Create a page and add it to the document
	Page page = new Page();
	document.getPages().add(page);

	// Create labels and add it to the page
	Label label1 = new Label("Docuemnt Additional Actions", 0, 50, 400, 50, Font.getCourier(), 20);
	Label label2 = new Label("Enter some text in the text field and save the file to see the document action :", 0, 150, 400, 50, Font.getCourier(), 15);
	page.getElements().add(label1);
	page.getElements().add(label2);

	// Create a text field and add it to the page
	TextField textField = new TextField("Text1", 385, 155, 100, 30);
	page.getElements().add(textField);

	// Create a java script action and assign it to the documnet reader event.
	JavaScriptAction action = new JavaScriptAction("app.alert(\"Hello your text Saved!!\")");
	document.getReaderEvents().setWillSave(action);
    
        // Save the PDF
        document.draw( "[physicalpath]/MyDocument.pdf" );
     }
    }